package com.xingkeduo.dto;

import com.xingkeduo.pojo.enums.CommentStar;
import com.xingkeduo.pojo.enums.ServiceType;
import com.xingkeduo.pojo.table.Comments;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

import java.time.LocalDateTime;


@Data
public class QueryByAdminIdResponseDto {


    //评论id
    private Long id;

    //用户昵称
    private String userNickName;


    //用户头像
    private String userImg;

    //评价时间
    private LocalDateTime CreatedTime;

    //店铺名称
    private String storeName;

    //服务类型 1剪发 2刘海 3高级
    private ServiceType serviceType;

    //评价内容（已过滤
    private String comment;

    //服务评分
    private int commentStar;

    //是否匿名
    private Boolean anonymous;

    //订单号
    private int orderNo;

    /**
     * 评价标签
     */
    private String[] judgementLabels;

    /**
     * 图片列表
     */
    private String[] pics;

    public void covert(Comments comments){
        if(StringUtils.isNotEmpty(comments.getJudgementLabel())){
            this.judgementLabels = comments.getJudgementLabel().split(",");
        }

        if(StringUtils.isNotEmpty(comments.getPicIds())){
            String [] arr = {"http://img3.redocn.com/20121107/Redocn_2012110116042258.jpg","http://img4.imgtn.bdimg.com/it/u=1931667813,845756437&fm=26&gp=0.jpg","http://pic162.nipic.com/file/20180425/8932624_153850085603_2.jpg"};
            this.pics = arr;
//            this.pics = comments.getPicIds().split(",");
        }

        if(comments.getCommentStar()!=null){
            this.commentStar = comments.getCommentStar().getKey();
        }
    }



}
